package eteam.aps.systeminterface.service;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.systeminterface.model.dto.DictionaryDto;
import eteam.aps.systeminterface.model.entity.DictionaryEntity;
import eteam.aps.systeminterface.model.entity.DictypeEntity;
import eteam.aps.systeminterface.model.reqparam.DicIdParam;
import eteam.aps.systeminterface.model.reqparam.GetBatchDicParam;
import eteam.aps.systeminterface.model.reqparam.GetDicParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 字典服务
 */
public interface IDicController {
    /**
     * 查询数据字典列表
     *
     * @return
     */
    @GetMapping(value = "/api/dic/getdiclist")
    R<List<DictionaryEntity>> getDicList() throws Exception, AuthException;

    /**
     * 查询数据字典分类列表
     *
     * @return
     */
    @GetMapping(value = "/api/dic/getdictypelist")
    R<List<DictypeEntity>> getDicTypeList() throws Exception, AuthException;

    /**
     * 新增数据字典
     *
     * @param dicDto: 数据字典
     * @return
     */
    @PostMapping(value = "/api/dic/createdic")
    R createDic(@Validated(Insert.class) @RequestBody DictionaryDto dicDto) throws Exception, AuthException;

    /**
     * 更新数据字典
     *
     * @param dicDto: 数据字典信息
     * @return
     */
    @PostMapping(value = "/api/dic/updatedic")
    R updateDic(@Validated(Update.class) @RequestBody DictionaryDto dicDto) throws Exception, AuthException;

    /**
     * 删除数据字典
     *
     * @param dicParam: 数据字典Id参数
     * @return
     */
    @PostMapping(value = "/api/dic/deletedic")
    R deleteDic(@Validated @RequestBody DicIdParam dicParam) throws Exception, AuthException;

    /**
     * 根据分类编码获取字典列表
     *
     * @param getDicParam
     * @return
     */
    @GetMapping(value = "/api/dic/getdicbytype")
    R<List<DictionaryEntity>> getDicByType(@Validated GetDicParam getDicParam) throws Exception, AuthException;

    /**
     * 根据分类编码集合获取字典列表
     *
     * @param getBatchDicParam
     * @return
     */
    @GetMapping(value = "/api/dic/getdicbytypes")
    R<List<DictionaryEntity>> getDicByTypes(@Validated GetBatchDicParam getBatchDicParam) throws Exception, AuthException;

    /**
     * 获取物料参数所需字典分类列表
     *
     * @return
     */
    @GetMapping(value = "/api/dic/getmtrparamdictypelist")
    R<List<DictypeEntity>> getMtrParamDicTypeList() throws Exception, AuthException;
}
